-
-
Notifications
You must be signed in to change notification settings - Fork 114
Simplify ensemble indexing #839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Should fix the segfaults on SciMLSensitivity, and there are tests to ensure it does not regress
| prob = ODEProblem((u, p, t) -> 1.01u, 0.5, (0.0, 1.0)) | ||
| A = [1 2 | ||
| 3 4] | ||
| prob = ODEProblem((u, p, t) -> A*u, ones(2,2), (0.0, 1.0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| prob = ODEProblem((u, p, t) -> A*u, ones(2,2), (0.0, 1.0)) | |
| prob = ODEProblem((u, p, t) -> A * u, ones(2, 2), (0.0, 1.0)) |
| ensemble_prob = EnsembleProblem(prob, prob_func = prob_func) | ||
| sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10) | ||
| sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10, saveat=0.01) | ||
| @test sim isa EnsembleSolution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10, saveat=0.01) | |
| sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10, saveat = 0.01) |
test/downstream/ensemble_diffeq.jl
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| @test size(sim[1,:,:,:]) == (2,101,10) | |
| @test size(sim[:,1,:,:]) == (2,101,10) | |
| @test size(sim[:,:,1,:]) == (2,2,10) | |
| @test size(sim[:,:,:,1]) == (2,2,101) | |
| @test Array(sim)[1,:,:,:] == sim[1,:,:,:] | |
| @test Array(sim)[:,1,:,:] == sim[:,1,:,:] | |
| @test Array(sim)[:,:,1,:] == sim[:,:,1,:] | |
| @test Array(sim)[:,:,:,1] == sim[:,:,:,1] | |
| @test size(sim[1, :, :, :]) == (2, 101, 10) | |
| @test size(sim[:, 1, :, :]) == (2, 101, 10) | |
| @test size(sim[:, :, 1, :]) == (2, 2, 10) | |
| @test size(sim[:, :, :, 1]) == (2, 2, 101) | |
| @test Array(sim)[1, :, :, :] == sim[1, :, :, :] | |
| @test Array(sim)[:, 1, :, :] == sim[:, 1, :, :] | |
| @test Array(sim)[:, :, 1, :] == sim[:, :, 1, :] | |
| @test Array(sim)[:, :, :, 1] == sim[:, :, :, 1] |
| @test sol[1,:,i] == sol.u[i][x] | ||
| @test sol[2,:,i] == sol.u[i][y] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| @test sol[1,:,i] == sol.u[i][x] | |
| @test sol[2,:,i] == sol.u[i][y] | |
| @test sol[1, :, i] == sol.u[i][x] | |
| @test sol[2, :, i] == sol.u[i][y] |
| # TODO: fix the interpolation | ||
| @test only.(sol(1.0, idxs = [x])) ≈ last.(sol[x, :]) | ||
| @test only.(sol(0.0, idxs = [x])) == sol[1, 1, :] | ||
| @test only.(sol(1.0, idxs = [x])) ≈ [sol[i][1, end] for i in 1:3] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
| @test only.(sol(1.0, idxs = [x])) ≈ [sol[i][1, end] for i in 1:3] | |
| @test only.(sol(1.0, idxs = [x])) ≈ [sol[i][1, end] for i in 1:3] |
Should fix the segfaults on SciMLSensitivity, and there are tests to ensure it does not regress